package com.fenghongzhang.broadcasttest;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

public class MyReceiver2 extends BroadcastReceiver {

    /**
     * 开启一个Activity, 开一个服务. 发送通知,
     * @param context
     * @param intent
     */
    @Override
    public void onReceive(Context context, Intent intent) {

        //接收一个值.
        String action = intent.getAction();
        if(action.equals("com.feng")){
            Bundle extras = intent.getExtras();
            String name = extras.getString("name");

            //发送一个值.->启动一个Activity,用intent传值
            Intent intent1 = new Intent(context, Main7Activity.class);
            intent1.putExtra("name", name);
            context.startActivity(intent1);


        }


    }
}
